package com.hsq.ndmall.mq;



import com.hsq.ndmall.mq.selector.AmqpSelector;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.core.annotation.Order;

/**
 * @author 黄四清
 * @version 1.0.0
 * @ClassName AmqpAutoConfiguration.java
 * @Description TODO
 * @createTime 2021年09月06日 19:23:00
 */
@Import(AmqpSelector.class)
@Order(-1) //默认值为0
@Configuration
@ConditionalOnProperty(name = {"spring.amqp.rabbit.enabled"}, matchIfMissing = false, havingValue = "true")
public class AmqpAutoConfiguration {
    @Bean
    public MessageConverter messageConverter() {
        return new Jackson2JsonMessageConverter();
    }
}
